import { getAllData as getAllCateData } from '@/api/content/cate'
import { getAllData as getAllTagData } from '@/api/content/tag'
export default {
  namespaced: true,
  state: {
    catelist: [],
    taglist: []
  },
  getters: {
  },
  mutations: {
    setList (state, payload) {
      state[payload.key] = payload.data
    }
  },
  actions: {
    // 获取所有分类
    async getCateList ({ commit }) {
      const res = await getAllCateData()
      commit('setList', {
        key: 'catelist',
        data: res
      })
    },
    // 获取所有标签
    async getTagList ({ commit }) {
      const res = await getAllTagData()
      commit('setList', {
        key: 'taglist',
        data: res
      })
    }
  }
}
